public class down {
    public static void main(String[] args) {
        Cat cat = new Cat("小黑",2);
        Dog dog = new Dog("小橘", 1);

        Animal animal1 = cat;
        Animal animal2 = dog;
        //animal1.mew();
        if(animal1 instanceof Cat){
            cat = (Cat)animal1;
            cat.mew();
        }
        //animal2.bark();
        if(animal2 instanceof Dog){
            dog = (Dog)animal2;
            dog.bark();
        }

    }
}
